from django import template
from django.contrib.sites.models import Site
from feedbag.apps.product.models import Review, ProductType

register = template.Library()

@register.inclusion_tag('recent_reviews.html', takes_context=True)
def recent_reviews(context):
    reviews = Review.objects.all().filter(active=True)
    
    return {
        'reviews': reviews,
        'request': context['request'],
        'settings': context['settings'],
    }

@register.inclusion_tag('product_types.html', takes_context=True)
def product_types(context):
    types = ProductType.objects.all()
    
    return {
        'types': types,
        'request': context['request'],
        'settings': context['settings'],
    }
    
@register.inclusion_tag('sidebar_product.html', takes_context=True)
def sidebar_product(context):    
    return {
        'request': context['request'],
        'settings': context['settings'],
    }
    
    

